package by.averianov.discounta.datamodel.compositekeys;

import java.io.Serializable;

import by.averianov.discounta.datamodel.Shop;

public class ProductPK implements Serializable {
	
	private Long id;
    private Long shop;
    
    public ProductPK() {}
    public ProductPK(Long id, Shop shop) {//Long shopId) {
      this.id = id;
      this.shop = shop.getId();
    }
    
	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}
	public Long getShopId() {
		return shop;
	}
	public void setShopId(Long shopId) {
		this.shop = shopId;
	}
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		result = prime * result + ((shop == null) ? 0 : shop.hashCode());
		return result;
	}
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		ProductPK other = (ProductPK) obj;
		if (id == null) {
			if (other.id != null)
				return false;
		} else if (!id.equals(other.id))
			return false;
		if (shop == null) {
			if (other.shop != null)
				return false;
		} else if (!shop.equals(other.shop))
			return false;
		return true;
	}

}